home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
comm
/
misc
/
zvm1_19.lha
/
include.zvm
< prev
next >
Wrap
Text File
|
1993-04-24
|
7KB
|
253 lines
/* THIS IS INCLUDED FROM INCLUDE.ZVM */
/*-------------------------HANDS OFF--------------------------------------*/
/* DON'T TOUCH THIS STUFF. IF YOU FIX SOMETHING HERE, TELL ME ABOUT IT */
/* This function gives you a simple way of presenting an N key menu
to the caller
ARGS: numKeys choiceFileName badChoiceFileName timeOut validChoices
numBadChoices
numKeys = number of keys wanted
choiceFileName = file name of the menu
badChoiceFileName = what to say if caller enters a bad choice
timeOut = number of seconds allowed before timing out
validChoices = list of characters that are valid choices
numBadChoices = number of times you want to present the menu before exiting
RETURNS: status, choice = valid key
*/
presentMenu: procedure expose choice status. mode.
parse arg numKeys,choiceFileName,badChoiceFileName,timeOut,validChoices,numBadChoices .
timesAround = numBadChoices;
do timesAround = numBadChoices to 1 by -1
status = playVoice(choiceFileName)
if status > status.keyDetected then signal presentMenuDone;
status = readNKeys(numKeys, timeOut)
if status = status.timedOut then do
call flushPhoneBuffer()
status = playVoice('voice:voices/Timed Out')
iterate
end
if status ~= status.normal then signal presentMenuDone;
choice = keys
if pos(choice, validChoices) = 0 then do
call flushPhoneBuffer()
status = playVoice(badChoiceFileName)
iterate
end
return status.normal
end
status = status.timedOut
presentMenuDone:
return status
/*----------------------------------------------------------------------*/
/* Here are the encapsulated functions. They're responsible for
communicating with ZVM. Don't edit or touch them, except for
bug fixes.
*/
playVoice: procedure expose status. mode.
parse arg fileName
address voicemail1 'playVoice' fileName
return rc
addLogEntry: procedure expose status. mode.
parse arg fileName, actualTime, duration
address voicemail1 'addLogEntry' fileName ',' actualTime ',' duration
return rc
setLogEntryStatus: procedure expose status. mode.
parse arg logEntryNumber, logEntryStatus
select
when logEntryStatus = ' ' then ls = 0
when logEntryStatus = 'a' then ls = 1
when logEntryStatus = 'd' then ls = 2
otherwise ls = -1
end
address voicemail1 'setLogEntryStatus' logEntryNumber ',' ls
return rc
getLogEntryData: procedure expose status. mode.
parse arg logEntryNumber
address voicemail1 'getLogEntryData' logEntryNumber
return result
getLogEntryFileName: procedure expose status. mode.
parse arg logEntryNumber
address voicemail1 'getLogEntryFileName' logEntryNumber
return result
getNumVoiceMessages: procedure expose status. mode.
address voicemail1 'getNumVoiceMessages'
return result
recordVoice: procedure expose status. mode.
parse arg fileName
address voicemail1 'recordVoice' fileName
return rc
password: procedure expose status. mode.
address voicemail1 'password'
return result
hasFax: procedure expose status. mode.
address voicemail1 'hasfax'
return result
playBeep: procedure expose status. mode.
parse arg tone1, tone2, duration
address voicemail1 'playBeep' tone1 ',' tone2 ',' duration
return rc
readNKeys: procedure expose status. keys mode.
parse arg numKeys, timeOut
address voicemail1 'readNKeys' numKeys ',' timeOut
if rc = status.normal then keys = result
return rc
read1Key: procedure expose status. key mode.
parse arg timeOut
address voicemail1 'read1Key' timeOut
if rc = status.normal then key = result
return rc
readKeysUntil: procedure expose status. keys mode.
parse arg terminatingCharacter, maxCharacters, timeOut
address voicemail1 'readKeysUntil' terminatingCharacter ',' maxCharacters ',' timeOut
if rc = status.normal then keys = result
return rc
readLine: procedure expose status. line mode.
parse arg timeOut
address voicemail1 'readLine' timeOut
if rc = status.normal then line = result
return rc
writeLine: procedure expose status. mode.
parse arg line
address voicemail1 'writeLine' line
return rc
/* the 'assumeUnknownMode' is to make sure that any use of a voice command WILL
cause ZVM to hang up the line, reset the modem, then do its stuff */
dropLine: procedure expose status. mode.
address voicemail1 'assumeUnknownMode'
address voicemail1 'requireMode' mode.commandMode
return rc
atCommands: procedure expose status. mode.
address voicemail1 'assumeUnknownMode'
address voicemail1 'requireMode' mode.connectedMode
return rc
use19200: procedure expose status. mode.
address voicemail1 'setserial'
return rc
flushPhoneBuffer: procedure expose status. mode.
address voicemail1 'flushPhoneBuffer'
return status.normal
listen: procedure expose status. mode.
address voicemail1 'listen'
return status.normal
answerFax: procedure expose status. mode.
address voicemail1 'answerFax'
return rc
cTime: procedure expose status. now mode.
address voicemail1 'ctime'
return result
displayError: procedure expose status. mode.
parse arg error
address voicemail1 'displayError' error
return status.normal
displayStatus: procedure expose status. mode.
parse arg status
address voicemail1 'displayStatus' status
return status.normal
/* Effectively unlistens also! */
setLastError: procedure expose status. mode.
parse arg status, error
address voicemail1 'setLastError' status ',' error
/*-----------------------------------------------------------------------*/
/* signal processing */
error:
say "Error " rc " at line " sigl
call listen()
exit 20
break_c:
halt:
say "VoiceMail was stopped manually"
call listen()
exit 20
novalue:
say "No Value at Line" sigl
call playVoice('voice:voices/NoValue')
call listen()
exit 20
syntax:
say 'Syntax Error at Line' sigl
call playVoice('voice:voices/SyntaxError')
call listen()
exit 20
/* Initialize everything needed to communicate correctly with ZVM */
doInitializations: procedure expose compression. mode. status. device.
/* compressions */
compression.ADPCM2 = 2
compression.ADPCM3 = 3
compression.CELP = 1
/* devices */
device.telephoneLine = 2
device.externalMic = 8
device.internalSpeaker = 16
/* modem modes */
mode.unknownMode = -1
mode.commandMode = 0
mode.voiceMode = 1
mode.connectedMode = 2
mode.playMode = 3
mode.recordMode = 4
/* return statuses from the various commands */
status.normal = 0
status.keyDetected = 1
status.quietDetected = 2
status.silenceDetected = 3
status.faxDetected = 4
status.busyDetected = 5
status.timedOut = 6
status.signalDetected = 7
status.overflow = 8
status.error = 9
return